
function chooseLogin() {
    var oLine = document.getElementById("line");
    var oSpan = oLine.getElementsByTagName("span")[0];
    var oBypassWord = document.getElementById("loginBypassWord");
    var oByPhone = document.getElementById("loginByPhone");
    var oPasswordLogin = document.getElementsByClassName("passwordLogin")[0];
    var oPhoneLogin = document.getElementsByClassName("phoneLogin")[0];
    oBypassWord.onclick = function () {
        this.classList.add("chooseDiv")
        oByPhone.classList.remove("chooseDiv");
        oSpan.style.left = "0";
        oPasswordLogin.style.display = "block"
        oPhoneLogin.style.display = "none"
    }
    oByPhone.onclick = function () {
        this.classList.add("chooseDiv")
        oBypassWord.classList.remove("chooseDiv")
        oSpan.style.left = "195px";
        oPhoneLogin.style.display = "block"
        oPasswordLogin.style.display = "none"
    }
    oBypassWord.click();
}
chooseLogin()
//账号验证
function inputNum() {
    $("#AccountNum").focus(function(){
        window.onkeyup = function (){
           $(".inputNum").text($("#AccountNum").val().length + "/11")
          }
    })
    $("#AccountNum").blur(function(){
        if(isTrue("AccountNum","isEmpty","登陆帐号不能为空")){
            isTrue("AccountNum","isLength","长度在 3 到 15 个字符",3,11)
        }       
    })
    $("#passNum").focus(function(){
        window.onkeyup = function (){
        if($("#passNum").val().length!==0){
            $(".x").css("display","block")
            $(".x").on("click",function(){
                $("#passNum").val("")
            })
        } else{
            $(".x").css("display","none")
        }
    }
    })

    $("#passNum").blur(function(){
        if(isTrue("passNum","isEmpty","密码不能为空")){
            isTrue("passNum","isLength","长度在 3 到 15 个字符",3,11)
        }   
        
    })
    $("#phoneNum").blur(function(){
        if(isTrue("phoneNum","isEmpty","手机号码不能为空"))
        isTrue("phoneNum","isPhoneNum","请输入正确的手机号")
    })
    $("#phoneNum").focus(function(){
            window.onkeyup = function (){
                $(".pPassNum").text($("#phoneNum").val().length + "/11")
               }
           
  
    })
    $("#verifyInput").blur(function(){
        isTrue("verifyInput","isEmpty","请输入验证码")
        $("#verifyInput").parent().next().css("bottom","-12px")
    })
    $("#btnLogin").on("click",function(e){
        e.preventDefault();
        $("#AccountNum").blur();
        $("#passNum").blur();
        if($("o").length===0){
            console.log("登录成功")
            indexCheck()
            // window.location.href="index.html";
        }
    })
    $("#btnPlogin").on("click",function(e){
        e.preventDefault();
        $("#phoneNum").blur();
        $("#verifyInput").blur()
        if($("o").length===0){
            alert("验证通过")
            // window.location.href="index.html";
        }
    })

    // $(".passwordLogin").submit(function(e){
    //     indexCheck()
    // })
}
inputNum()
// 忘记密码验证
function forgotNum(){
    $("#forgotPnum").blur(function(){
        if(isTrue("forgotPnum","isEmpty","手机号码不能为空"))
        isTrue("forgotPnum","isPhoneNum","请输入正确的手机号")
        $(".forgotSpan").text($("#forgotPnum").val().length + "/11")
    })
    $("#forgotPnum").focus(function(){
            window.onkeyup = function (){
                $(".forgotSpan").text($("#forgotPnum").val().length + "/11")
               }
    })
    $("#verInput").blur(function(){
        isTrue("verInput","isEmpty","请输入验证码")
    })

    $("#forgotPasswords").blur(function(){
        isTrue("forgotPasswords","isEmpty","密码不能为空")
        isTrue("affirm","isAffirm","两次密码不一样","forgotPasswords")
    })
    $("#affirm").focus(function(){
        window.onkeyup = function (){
            isTrue("affirm","isAffirm","两次密码不一样","forgotPasswords");
        }
    })
    $("#affirm").blur(function(){
        isTrue("affirm","isAffirm","两次密码不一样","forgotPasswords");
    })
    $("#amend").click(function(){
        $("#forgotPnum").blur();
        $("#verInput").blur();
        $("#forgotPasswords").blur();
        $("#affirm").blur();
        if($("o").length===0){
            alert("修改成功")
            // window.location.href="index.html";
        }
    })
}
forgotNum()
function closeForgot(){
    $("#close").on("click",function () {
        window.location.reload()
})
    $(".close").on("click",function () {
        window.location.reload()
})
}
closeForgot()
function register() {
    $("#toRegister").on("click",function(){
        window.location.href="./login.html"
    })
  }
 register()
//遮罩，未调动
function shadePrompt(){
    $(".modal-content").append($("<div></div>").css({
        "width":"100%",
        "height":"100%",
        "background":"rgba(0,0,0,.3)",
        "position":"absolute",
        "top":"0"
    }).addClass("shade"))
    $(".shade").html("<p><span>确认关闭</span><a>X</a></p><button type='button'>取消</button><button type='button'>确定</button>")
    $
 }
